package cn.com.huzo.model.entities.master;

import huzofw.model.entities.BaseEntity;
import huzofw.model.entities.IAggregateRoot;
import java.io.Serializable;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;

/**
 * 部门主文件实体类
 *
 * @author 吴旭
 */
public class DepartmentEntity extends BaseEntity implements Serializable, IAggregateRoot {

    private static final long serialVersionUID = 6314696095497137911L;
    private Long DepartmentId;
    private Long ParentId;
    private String OrderNo;
    private String DepartmentName;
    private String NodeType;
    private String Description;
    /**
     * 上级部门名
     */
    private String ParentName;
    /**
     * 在部门树的位置
     */
    private Long Level;
    /**
     * 子节点个数
     */
    private Long NumChildren;

    public Long getDepartmentId() {
        return DepartmentId;
    }

    public Long getParentId() {
        return ParentId;
    }

    public String getOrderNo() {
        return OrderNo;
    }

    public String getDepartmentName() {
        return DepartmentName;
    }

    public String getNodeType() {
        return NodeType;
    }

    public String getDescription() {
        return Description;
    }

    public String getParentName() {
        return ParentName;
    }

    public Long getLevel() {
        return Level;
    }

    public Long getNumChildren() {
        return NumChildren;
    }

    public void setDepartmentId(Long DepartmentId) {
        this.DepartmentId = DepartmentId;
    }

    public void setParentId(Long ParentId) {
        this.ParentId = ParentId;
    }

    public void setOrderNo(String OrderNo) {
        this.OrderNo = OrderNo;
    }

    public void setDepartmentName(String DepartmentName) {
        this.DepartmentName = DepartmentName;
    }

    public void setNodeType(String NodeType) {
        this.NodeType = NodeType;
    }

    public void setDescription(String Description) {
        this.Description = Description;
    }

    public void setParentName(String ParentName) {
        this.ParentName = ParentName;
    }

    public void setLevel(Long Level) {
        this.Level = Level;
    }

    public void setNumChildren(Long NumChildren) {
        this.NumChildren = NumChildren;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof DepartmentEntity)) {
            return false;
        }

        final DepartmentEntity that = (DepartmentEntity) o;

        return new EqualsBuilder()
            .append(this.getParentId(), that.getParentId())
            .append(this.getDepartmentName(), that.getDepartmentName())
            .isEquals();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public int hashCode() {
        int result = 17;
        result = 31 * result + this.getParentId().hashCode();
        result = 31 * result + this.getDepartmentName().hashCode();

        return result;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }
}
